<div id="dashboard" role="navigation" class="wrangling">
  <ul class="navigation" role="navigation">
    <% if current_user.is_a?(User) %>
    <li><%= span_if_current('Wrangling Home', tag_wrangler_path(current_user)) %></li>
    <% end %>
    <li><%= span_if_current('Mass Wrangling', tag_wranglings_path) %></li>
    <li><%= span_if_current('Wranglers', tag_wranglers_path) %></li>
    <li><%= span_if_current('Discussion', discuss_tag_wranglings_path) %></li>
    <li><%= span_if_current('Search Tags', search_tags_path) %></li>
    <li><%= span_if_current('New Tag', new_tag_path) %></li>

    <% if @counts %>
      <li><hr /></li>
      <% if @tag && @uses %>
        <% for key in @uses %>
          <% if key == 'Works' || key == 'Bookmarks' %>
          <li><%= span_if_current "#{key} (#{@counts[key]})", {:controller => key.downcase.to_sym, :action => :index, :tag_id => @tag} %></li>
          <% else %>
          <li><span><%= "#{key} (#{@counts[key]})" %></span></li>
          <% end %>
        <% end %>
      <% elsif @tag  && @tag.child_types %>
        <% for tag_type in @tag.child_types %>
          <li>
            <%= span_if_current tag_type.pluralize + " (#{@counts[tag_type.underscore.pluralize.to_sym]})", url_for(:show => tag_type.underscore.pluralize, :id => @tag) %>
          </li>
        <% end %>
      <% else %>
      <li><%= span_if_current "Fandoms by media (#{@counts[:fandoms]})", tag_wranglings_path(:show => "fandoms") %></li>
      <li><%= span_if_current "Characters by fandom (#{@counts[:characters]})", tag_wranglings_path(:show => "characters") %></li>
      <li><%= span_if_current "Relationships by fandom (#{@counts[:relationships]})", tag_wranglings_path(:show => "relationships") %></li>
      <li><%= span_if_current "Relationships by character", tag_wranglings_path(:show => "character_relationships") %></li>
      <li><%= span_if_current "Freeforms by fandom (#{@counts[:freeforms]})", tag_wranglings_path(:show => "freeforms") %></li>
      <% end %>
    <% end %>
  </ul>
</div>
